const Koa =require('koa')
const cors=require('koa2-cors')
const bodyParser = require('koa-bodyparser')
const router=require('../server/router')
const app=new Koa()


// 配置跨域
app.use(cors({
    origin:(ctx=>'*'),
    allowMethods: ['GET', 'POST', 'DELETE','OPTIONS'],
}))
app.use(bodyParser())
app.use(router.routes())

const port = 3000;
app.listen(port, function() {
  console.log(`server started at localhost:${port}`);
});